package aad.storyboard.model;

import java.util.Observable;
import java.util.Observer;

import android.app.Activity;
import android.content.Context;
import android.media.AudioManager;

/**
 *  Story settings class, container for all settings, and observable, in order to synchronize multiple commands (such as seekbar/button)
 */
public class StorySettings extends Observable{
	private int volume = 50;
	private boolean wikiMode = true;
	private boolean scripts = true;
	private Activity activity;
	private AudioManager am;
	
	public int getVolume() {
		return volume;
	
	}
	public void setVolume(int volume) {
		System.out.println("VOLUME CHANGED");
		this.volume = volume;
		this.notifyObservers();
		if(am != null)
			am.setStreamVolume(AudioManager.STREAM_MUSIC, this.volume, 0);
			
	}
	public boolean isWikiMode() {
		return wikiMode;
	}
	public void setWikiMode(boolean wikiMode) {
		System.out.println("WIKI CHANGED");
		this.wikiMode = wikiMode;
		this.notifyObservers();
	}
	public boolean isScripts() {
		return scripts;
	}
	public void setScripts(boolean scripts) {
		System.out.println("SCRIPT CHANGED");
		this.scripts = scripts;
		this.notifyObservers();
	}
	public void setActivity(Activity a) {
		this.activity = a;
		am = (AudioManager) this.activity.getSystemService(Context.AUDIO_SERVICE);
		this.setVolume(am.getStreamVolume(AudioManager.STREAM_MUSIC));
	}
	

}
